﻿using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace CsRedisSample.Infrastructure.Extensions
{
    public static class CsRedisCacheExt
    {
        public static IServiceCollection AddRedisCache(this IServiceCollection services,Action<CsRedisOptions> action)
        {
            services.AddOptions();
            services.Configure(action);
            services.AddSingleton(ServiceDescriptor.Singleton<IDistributedCache, CsRedisCache>());

            return services;
        }
    }
}
